package org.lcc.util;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ApiResponseMe {
    private int code;
    private String message;
    private Object data;

    public ApiResponseMe() {
    }

    public ApiResponseMe(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ApiResponseMe success(Object data) {
        return new ApiResponseMe(200, "操作成功", data);
    }

    public static ApiResponseMe error(int code, String message) {

        return new ApiResponseMe(code, message, null);
    }

    public static ApiResponseMe shape(Boolean boolen, String message) {
        return new ApiResponseMe(boolen ? 200 : 400, message, null);
    }

}